package com.shanshi.activity;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

public class WithDrawals extends MainActivity{

	private SharedPreferences sharedPreferences;
	private String money;
	private TextView tv;
	private TextView canceltv;

	private TextView with_restmoney;
	private EditText with_money;
	private ImageView with_zhifubao;
	private ImageView with_weixin;
	private ImageView with_select;
	private boolean select = false;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.withdrawals);

		//获得余额
		sharedPreferences = WithDrawals.this.getSharedPreferences("share", MODE_PRIVATE);
		money = sharedPreferences.getString("money","0.00");

		tv = (TextView) findViewById(R.id.titls2);
		tv.setText("零钱提现");
		canceltv = (TextView) findViewById(R.id.cancel);
		canceltv.setText("");

		with_restmoney = (TextView) findViewById(R.id.with_restmoney);
		with_restmoney.setText("￥"+money);
		with_money = (EditText) findViewById(R.id.with_money);
		with_zhifubao = (ImageView) findViewById(R.id.with_zhifubao);
		with_weixin = (ImageView) findViewById(R.id.with_weixin);
		with_select = (ImageView) findViewById(R.id.with_select);

	}

	public void nextStep(View v){
		switch (v.getId()){
			case R.id.with_all:
				with_money.setText(money);
				with_money.setSelection(money.length());
				break;
			case R.id.with_zhifubao:
				with_zhifubao.setImageResource(R.drawable.selected);
				with_weixin.setImageResource(R.drawable.unchecked);
				break;
			case R.id.with_weixin:
				with_zhifubao.setImageResource(R.drawable.unchecked);
				with_weixin.setImageResource(R.drawable.selected);
				break;
			case R.id.with_select:
				if(!select){
					with_select.setImageResource(R.drawable.check);
				}else{
					with_select.setImageResource(R.drawable.unchecked);
				}
				select = !select;
				break;
			case R.id.with_cancel:
				finish();
				break;
			case R.id.with_submit:
				Intent intent = new Intent(this,WithDrawalDetails.class);
				startActivity(intent);
				break;
		}
	}


}
